home *** CD-ROM | disk | FTP | other *** search
/ SGI Freeware 1999 August / SGI Freeware 1999 August.iso / dist / fw_ghostscript.idb / usr / freeware / bin / ps2epsi.z / ps2epsi
Encoding:
Text File  |  1998-05-21  |  723 b   |  50 lines

  1. #!/bin/sh
  2.  
  3. export outfile
  4.  
  5. if [ $# -lt 1 -o $# -gt 2 ]; then
  6.     echo "Usage: `basename $0` file.ps [file.epsi]" 1>&2
  7.     exit 1
  8. fi
  9.  
  10. infile=$1
  11.  
  12. if [ $# -eq 1 ]
  13. then
  14.     case "${infile}" in
  15.       *.ps)        base=`basename ${infile} .ps` ;;
  16.       *.cps)    base=`basename ${infile} .cps` ;;
  17.       *.eps)    base=`basename ${infile} .eps` ;;
  18.       *.epsf)    base=`basename ${infile} .epsf` ;;
  19.       *)        base=`basename ${infile}` ;;
  20.     esac
  21.     outfile=${base}.epsi
  22. else
  23.     outfile=$2
  24. fi
  25.  
  26. gs -q -dNOPAUSE -sDEVICE=bit -sOutputFile=/dev/null ps2epsi.ps < ${infile} 1>&2
  27.  
  28. (
  29. cat << BEGINEPS
  30. save
  31. countdictstack
  32. mark
  33. newpath
  34. /showpage {} def
  35. BEGINEPS
  36.  
  37. cat ${infile}
  38.  
  39. cat << ENDEPS
  40. cleartomark
  41. countdictstack exch sub { end } repeat
  42. restore
  43. ENDEPS
  44.  
  45. ) >> ${outfile}
  46.  
  47. exit 0
  48.  
  49.  
  50.